home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / webtp55.zip / ASMDEMO.WEB < prev    next >
Text File  |  1989-11-29  |  925b  |  39 lines

  1. % This is ASMDEMO.WEB
  2. % Simple demo to show the inline-assembler in Tangle TP55
  3. % 29-Nov-89 Peter Sawatzki
  4. %
  5. % Tangle instructions:
  6. %   TANGLE ASMDEMO /c
  7. %                   ^---- include comments
  8. %
  9. @* TANGLE TP55 Test
  10.  
  11. @d Asm(#)==inline(@[#@])
  12. @d NoOp==Asm(nop)
  13.  
  14. @d IntOff==Asm(cli)
  15. @d IntOn==Asm(sti)
  16. @d Keyboard==int $16
  17.  
  18. @p program InlTest;
  19. var
  20.   Key: Word;
  21. begin
  22.   WriteLn('This Program is a silly test for Tangle Inline/TP55');
  23.   NoOp; {just for fun}
  24.   IntOff;
  25.   IntOn;
  26.   Write('Press a key: ');
  27.   Asm(mov ah,0/     {subfunction 0, read char}
  28.       Keyboard/     {keyboard - read char from buffer}
  29.       mov [>Key],ax);
  30.   WriteLn(' -> ',Char(Lo(Key)),' ScanCode: ',Hi(Key));
  31.  
  32.   Write('Another key to quit:');
  33.   Asm(lp:  mov ah,1/ {wait for keystroke}
  34.            Keyboard/
  35.            jz lp/   {loop, if no key pressed}
  36.            mov ah,0/
  37.            Keyboard); {discard key}
  38. end.
  39.